<?php
namespace app\web\model;

/**
 * @package app\basic\model
 */
class Follow extends Base 
{
    /**
     * 是否关注
     * [isFollow description]
     * @param  [type]  $t_id [description] 技师ID/项目id
     * @param  [type]  $uid  [description] 用户id
     * @param  boolean $flag [description] true=>技师 false=>项目
     * @return boolean       [description]
     */
    public static function isFollow($t_id,$uid,$flag = true)
    {
        $where = ['user_id'=>$uid];
        if($flag) {
            $where['technician_id'] = $t_id; 
        }else{ 
            $where['project_id'] = $t_id; 
        }
        $find = self::where($where)->find();
        return $find ? 1 : 0;
    }
}
